Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the WordPress.org plugin preview #297

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Dec 18, 2023

Description of the Change

WordPress.org recently launched support for plugin previews utilizing the WordPress Playground feature. Plugins wanting to take advantage of this need to opt in by setting up a blueprint.json file that configures how the preview should load. This PR adds in that file that does the following:

  1. Sets up an environment running PHP 7.4 (our supported minimum) and the latest version of WordPress
  2. Logs into the admin
  3. Installs and activates the plugin
  4. Sends the user to the Autoshare settings page

Note that this PR is targeted to trunk so we can take advantage of our Plugin Asset Update Action to deploy these changes without having to push out a new release. But because this plugin deploys composer dependencies, this Action won't work until 10up/action-wordpress-plugin-asset-update#54 is merged

Also note once these changes are on .org, the preview button will need to be enabled in a test state. Once verified as working, we can enable it for all users.

How to test the Change

The WordPress Playground allows you to spin up a new environment directly through the URL, by going to https://playground.wordpress.net/# and pasting your JSON config after the #. In this case, the URL should be: https://playground.wordpress.net/#{%20%22$schema%22:%20%22https://playground.wordpress.net/blueprint-schema.json%22,%20%22landingPage%22:%20%22\/wp-admin\/admin.php?page=autoshare-for-twitter%22,%20%22preferredVersions%22:%20{%20%22php%22:%20%227.4%22,%20%22wp%22:%20%22latest%22%20},%20%22phpExtensionBundles%22:%20[%22kitchen-sink%22],%20%22steps%22:%20[%20{%20%22step%22:%20%22login%22,%20%22username%22:%20%22admin%22,%20%22password%22:%20%22password%22%20},%20{%20%22step%22:%20%22installPlugin%22,%20%22pluginZipFile%22:%20{%20%22resource%22:%20%22wordpress.org\/plugins%22,%20%22slug%22:%20%22autoshare-for-twitter%22%20},%20%22options%22:%20{%20%22activate%22:%20true%20}%20}%20]%20}

Changelog Entry

Added - Support for the WordPress.org plugin preview

Credits

Props @dkotter

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter added this to the 2.2.0 milestone Dec 18, 2023
@dkotter dkotter requested a review from jeffpaul as a code owner December 18, 2023 22:29
@dkotter dkotter self-assigned this Dec 18, 2023
@jeffpaul
Copy link
Member

@dkotter @iamdharmesh I wonder if its worth trying to create test/demo credentials so folks don't have to run through that setup step in the plugin and jump right into seeing some sample posts & tweeting/posting to X/Twitter?

@dkotter
Copy link
Collaborator Author

dkotter commented Dec 18, 2023

@dkotter @iamdharmesh I wonder if its worth trying to create test/demo credentials so folks don't have to run through that setup step in the plugin and jump right into seeing some sample posts & tweeting/posting to X/Twitter?

This would be the ideal for a demo (I considered the same thing for our Apple Maps Block plugin). My main concern I came to was how do we prevent someone from taking those credentials and misusing them, since they would be easy to find if we're going to use those in our blueprint file? Or is that something that even needs to be cared about?

@jeffpaul
Copy link
Member

Yeah, I thought perhaps if WP Playground could take a secret somehow as input but as @dkotter @iamdharmesh mentioned elsewhere that could still be exported from the DB in the browser session so probably best to have folks enter their own credentials to test the plugin.

@iamdharmesh
Copy link
Member

Note:
Getting Fatal during connecting X/Twitter account. So, want to put this ON HOLD until we figure this out and solve it.

image

@dkotter
Copy link
Collaborator Author

dkotter commented Dec 20, 2023

Yeah, didn't fully test myself but getting the same error.

Seems the Playground environment doesn't yet support curl: WordPress/wordpress-playground#85

As such, probably not worth deploying this change yet as you can't actually fully test things until this gets resolved upstream

@jeffpaul jeffpaul modified the milestones: 2.2.0, Future Release Jan 2, 2024
@jeffpaul jeffpaul marked this pull request as draft January 2, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants